<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/WEB-INF/templates/basic_template.xhtml">
	<ui:define name="content">
		<p:messages id="msgs" />
		<h:form>
			<p:messages id="msgs" />
			<br />
			<p:dataTable var="item" value="#{userMBean.usersList}"
				paginator="true" rows="10"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="5,10,15" paginatorAlwaysVisible="false">

				<f:facet name="header">Lista de Usuários</f:facet>

				<p:column headerText="Login">
					<h:outputText value="#{item.login}" />
				</p:column>

				<p:column headerText="Email">
					<h:outputText value="#{item.email}" />
				</p:column>

				<p:column headerText="Permissão">
					<h:outputText value="#{item.role}" />
				</p:column>

				<p:column>
					<div align="center">
						<p:commandLink action="#{userMBean.carregarEditar()}">
							<h:outputText value="Editar" />
						</p:commandLink>
					</div>
				</p:column>

				<p:column>
					<div align="center">
						<p:commandLink action="#{userMBean.excluirUsuario()}">
							<h:outputText value="Excluir" />
						</p:commandLink>
					</div>
				</p:column>

			</p:dataTable>

		</h:form>
	</ui:define>
</ui:composition>
</html>